<?php

namespace App\Services\PolicyUpload;

use Curl\StrService\StrService;

class QnService
{

    /**
     * 处理去哪数据
     * @param $param
     * @return void
     */
    public static function QnDataSet(&$param){


        $param['url'] = env('APP_URL').'/api/qn/notify';
    }

    /**
     * 上传政策参数转化 去哪
     * @param $param
     */
    public static function platformUpload($param) {

        $item['flightcode']               = $param['hs_code'];
        $item['supportCba']               = '是';
        $item['policycode']               = $param['policy_code'];
        $item['status']                   = $param['status'] == 1 ? '有效' : '失效';
        $item['dpt']                      = $param['depart_city_code'];
        $item['arr']                      = $param['arrived_city_code'];
        $item['cabin']                    = $param['cabin_code'];
        $item['flightcondition']          = $param['hs_code'].$param['flight_code'];
        $item['startdate']                = $param['date'];
        $item['enddate']                  = $param['date'];
        $item['depttimeslot']             = null;
        $item['productMark']              = $param['productMark'];
        $item['saledatestart']            = $param['startSellDate'];
        $item['saledateend']              = $param['endSellDate'];
        $item['cardtype']                 = 0;
        $item['printsource']              = '指定票面价';
        $item['printprice']               = $param['seller_price'];
        $item['highDemandType']           = '不处理';
        $item['highDemandThreshold']      = null;
        $item['flightNoLimit']            = '适用';
        $item['shared']                   = $param['is_share'] == 'T' ? '是' : '否';
        // 是否生成PNR
        $item['needPnr']                  = '否';
        // 是否进行PAT：A校验
        $item['needPata']                 = '否';
        $item['cabinNote']                = 'zc';
        $item['earliestBeforeTicket']     = 0;
        $item['beforeTicket']             = 0;
        $item['policyReturnPoint']        = 0;
        $item['policyReturnPrice']        = 0;
        $item['autoPriceThreshold']       = 0;
        $item['percentPriceThreshold']    = 0;
        $item['maxStock']                 = $param['seat'];
        return $item;
    }
}